
#include "Merchant.h"
#include "Platform.h"

Merchant::Merchant(int mid, Commodity com, Platform* platform)
    : mid_(mid)
    , commodity_(std::move(com))
    , platform_(platform)
{

}

int Merchant::git_mid() const
{
  return mid_;
}

Commodity& Merchant::Sell()
{
  return commodity_;
}

void Merchant::set_platform(Platform* platform)
{
  this->platform_ = platform;
}

bool Merchant::Send(int receiver, std::string msg)
{
  return platform_->Dispatch(Message(mid_, receiver, std::move(msg)));
}
